from flask import Flask
from flask import request
import random
app = Flask(__name__)


@app.route("/api/user/stu_info", methods=["POST"])
def stu_info():
    userList = ["小黑", "小白", "小明", "小红"]
    result = {"name": None}
    if request.method == "POST":
        name = request.form.get("name")
        if name in userList:
            result = {"name": name, "age": random.randint(10,30)}
            return result
    return result


if __name__ == "__main__":
    app.run(port=5050)
